www.gusucode.com > 6KBBS ASP版 V7.1 > 6KBBS ASP版 V7.1\code\bbs\adminbd2.asp

    <!--#include file="up.asp"-->
<!--#include file="inc/page.asp"-->
<%
if usertype<3 or (usertype=3 and instr("|"&adminbd&"|","|"&bd&"|")=0) then
tl=" 操 作 失 败"
mes="<b>对不起!权限不够。</b>"
call sendinfo(tl,mes)
call down
response.end
end if%><SCRIPT src=inc/menu.js></script>
<div class=adminbdlan><a href="adminbd.asp?bd=<%=bd%>&action=gonggao">发布公告</a> | <a href="adminbd.asp?bd=<%=bd%>&action=gonggaogl">公告管理</a><%if bdtype=3 then%> | <a href="adminbd.asp?action=passuser&bd=<%=bd%>"> 认证用户</a><%end if%> | <a href="adminbd2.asp?action=recycle&bd=<%=bd%>">回 收 站</a></div>
<%
dim action,sql,ii,iii,pagesetup,totalpage,count,pagecount,content,usedtable,tablestr,delbbsid,baction,color,value,topictype,sql1,sql2,str1,str2,paper
topictype=checknum(request.querystring("topictype"))
action=request.querystring("action")
select case action
%>
<%case"editgg"
set rs=conn.execute("select*from paper where id="&id&"")
paper=rs("paper")
paper=split(paper,"|")

%>
<SCRIPT>
function checkeditor(editor)
{
if(editor=="html")
	{
				document.getElementById("ubbeditordiv").style.display = 'none';
				document.getElementById("htmltoolbar").style.display = 'block';
				EDITFORM_DOCUMENT.body.innerHTML = document.getElementById("CodeForm").value;
				document.getElementById("editTextarea").style.display = 'none';
				document.getElementById("editIframe").style.display = 'block';
				HtmlDisableToolbar(false);
	}
else if(editor=="ubb")
	{
				document.getElementById("ubbeditordiv").style.display = 'block';
				document.getElementById("htmltoolbar").style.display = 'none';
				document.getElementById("CodeForm").value = HtmlHtmlToXhtml(EDITFORM_DOCUMENT.body.innerHTML);
				document.getElementById("editIframe").style.display = 'none';
				document.getElementById("editTextarea").style.display = 'block';
				HtmlDisableToolbar(true);
	}
}

function preview()
{
if(htmlsubmit()){
document.form1.topic.value=document.topicform.ggtitle.value;
document.form1.content.value=document.topicform.content.value;
var popupWin = window.open('paper.asp?action=preview', 'showgg', 'width=500,height=400,resizable=1,scrollbars=yes,menubar=no,status=yes');
document.form1.submit()
}
}

</SCRIPT>
<div class=adminbdtitle>编辑公告</div>
<div class=adminbdbody>

<form method="POST" action="adminbd.asp?action=editggok&bd=<%=bd%>&id=<%=id%>" name="topicform" onsubmit="htmlsubmit()">
<table border="0" cellpadding="0" style="border-collapse: collapse" width="100%">
      <tr>
        <td width="200">
        <p style="line-height: 120%; margin: 4"><b>公告标题:</b></td>
        <td>
        <p style="line-height: 120%; margin: 4">
        <input type="text" name="ggtitle" size="80" value="<%=checkform(paper(0))%>"></td>
      </tr>
      <tr>
        <td  valign="top" width="200">
        <p style="line-height: 150%; margin: 5"><b>帖子内容:</b><br>
		<input type="radio" name="usereditor" value="html" onclick="checkeditor('html')" checked>使用Html编辑器<br>
		<input type="radio" name="usereditor" value="ubb" onclick="checkeditor('ubb')">使用UBB编辑器<br>

</td>
<td valign="top" style="padding:5px;">
<textarea name="content" cols="40" rows="2" style="display:none"><%=paper(3)%></textarea>
<SCRIPT src="Editor/Ubb/UbbEditor.js"></SCRIPT>
<script type="text/javascript" src="Editor/Html/htmlEditor.js"></script>

<script>

var ubbedit=new UbbEditor("CodeForm",100,14,"default values","editor/ubb/images/");
ubbedit.showeditor();
</script>


<script type="text/javascript">
var editor = new htmlEditor("editor");
editor.hiddenName = "content";
editor.width = "100%";
editor.height = "300px";
editor.imagePath="editor/html/images/";
editor.iconPath = 'editor/html/images/face/';
editor.show();

var strlength;

//提交表单
function submitform(){
   	if(htmlsubmit())
   		{document.topicform.submit();}
}

//检测表单
function htmlsubmit() {
	if(document.getElementsByName("usereditor").item(0).checked==true){
		var content = editor.data();
	}
	else if(document.getElementsByName("usereditor").item(1).checked==true){
		checkeditor("html");
		var content = editor.data();
		checkeditor("ubb");
	}
	
		strlength=document.getElementsByName("content").item(0).value.length;
		if (strlength>25600||strlength<5){
			alert("您输入的文章长度为"+strlength+",长度必须大于5且小于25600,请修正之后再继续。");
			return false;
		}
		else if(document.getElementsByName("ggtitle").item(0).value==""){
			alert("标题不能为空。");
			document.getElementsByName("ggtitle").item(0).focus();
			return false;
		}
		else{
			return true;
		}
}

</script>

</td>
      </tr>
      <tr>
        <td colspan="2" align="center" height="40" >
        <input class=submit type=button value=OK_!修改 name=B1 onclick="submitform()">&nbsp;&nbsp;&nbsp; <input class=submit type=button value="预  览!" onclick=preview()>&nbsp;&nbsp;&nbsp; <input class=submit type=reset value=NO_!重写 name=B2>&nbsp; [ 按 Alt+Enter 直接发送 ]</td>
      </tr>
      </table>
</form>
</div>
<form name=form1 action=paper.asp?action=preview method=post target=showgg>
<input type=hidden name=topic value=><input type=hidden name=content value=>
</form>
<%case"recycle"
usedtable=application(prefix&"usedtable")
usedtable=split(usedtable,"|")
for i=1 to ubound(usedtable)
	str1="话题"
	str2="回帖"
	color="" 
	
	if int(usedtable(i))=totable then
	color="bold" 
	if topictype=1 or topictype="" then
	str1="<b>话题</b>"
	elseif topictype=2 then
	str2="<b>回帖</b>"
	end if
	end if
	
	tablestr=tablestr&"·<a href=?action=recycle&totable="&usedtable(i)&"&bd="&bd&"><font style='font-weight:"&color&"'>数据表 "&usedtable(i)&"</font></a> [<a href=?action=recycle&totable="&usedtable(i)&"&bd="&bd&"&topictype=1>"&str1&"</a>][<a href=?action=recycle&totable="&usedtable(i)&"&bd="&bd&"&topictype=2>"&str2&"</a>] "
next
response.write"<script language='javascript'>function Check(){var Name=document.form.topage.value;document.location='?bd="&bd&"&action=recycle&topage='+Name+'&totable="&totable&"';}</script>"
%><SCRIPT language=JavaScript>
function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++){
    var e = form.elements[i];
    if (e.name != 'chkall')       e.checked = form.chkall.checked; 
   }
  }
</SCRIPT>
<div class=adminbdtabletitle><%=tablestr%></div>

<form method="POST" action="adminbd2.asp?action=delbbsgg&bd=<%=bd%>&totable=<%=totable%>&topictype=<%=topictype%>">

<div align="center">

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse"   height="28" width="100%" bordercolor="#D2D2D2">
  <tr>
    <td width="5%" align="center">选择</td>
    <td width="55%" align="center">主题</td>
    <td width="15%" align="center">作者</td>
    <td width="25%" align="center">发表时间</td>
  </tr>
</table>
</div>
<%
Dim urlstr,pagestr,wzcount,wzpagecount,wzpage,wzrep
pagesetup=checknum(application(prefix&"topiclistpage"))
wzrep=pagesetup
urlstr="bd="&bd&"&totable="&totable&"&action=recycle"
if topictype=1 or topictype="" then
	sql="select * from bbs"&totable&" where type=3 and bd="&bd&" and bid=0"
elseif topictype=2 then
	sql="select * from bbs"&totable&" where type=3 and bd="&bd&" and bid<>0"
end if

set rs = server.createobject("adodb.recordset")
	rs.Open sql,conn,1
		if rs.eof or rs.bof then
			response.write"<div class=norecord>暂无记录</div>"
		else
		
			wzcount=rs.recordcount
			
			conn.execute("update bdinfo set topicnum="&wzcount&" where id="&bd&" and followid<>0")
			
			wzpagecount = abs(int(-abs(wzcount/wzrep)))
			wzpage = clng(request.querystring("page"))
			if len(wzpage) = 0 or wzpage = 0 then wzpage = 1
			rs.absoluteposition=rs.absoluteposition+((abs(wzpage)-1)*wzrep)
			pagestr="每页<font color=red>"&wzrep&"</font>条 共<font color=red>"&wzpagecount&"</font>页 ["&pagination(wzpagecount,urlstr)&"]&nbsp;"
			
			for i = 0 to wzrep-1
				if rs.eof then exit for

				content=rs("content")
				content=split(content,"|")
				
				if topictype=1 or topictype="" then
					value=rs("id")
				elseif topictype=2 then
					value=rs("bbsid")
				end if
%>
<table border="0" cellpadding="0" style='border-collapse: collapse; border:1px solid #d2d2d2;border-top:0px solid #ffffff' height="28" width="100%" bordercolor="#EFE8E2">
  <tr>
    <td width="5%" align="center">
    <input type="checkbox" name="delbbsid" value="<%=value%>"></td>
    <td width="55%">&nbsp; <a href=# onclick=openscript('paper.asp?action=showdelbbs&bbsid=<%=rs("bbsid")%>&totable=<%=totable%>&bd=<%=bd%>')><%=lefttrue(checktitle(content(4)),40)%></a></td>
    <td width="15%" align="center"><%=checktitle(content(2))%></td>
    <td width="25%" align="center"><%=checktitle(content(5))%></td>
  </tr>
</table>
<%
				rs.movenext
			next
		end if
	rs.Close
set rs=nothing
%>

<div align="center">

<table border="0" cellpadding="0" style='border-collapse: collapse; border-left-style: solid; border-right-style: solid; border-bottom-style: solid; ' height="35" width="100%" >
  <tr>
    <td width="100%">
    &nbsp;<input onclick=CheckAll(this.form) type="checkbox"  name=chkall value="ON">全 选&nbsp;&nbsp;&nbsp;
<INPUT type=submit value=" 删除所选 " name=action onclick="{if(confirm('确定删除你所选择的帖子吗?')){return true;}return false;}"> <INPUT type=submit value=" 还原所选 " name=action onclick="{if(confirm('确定还原你所选择的帖子吗?')){return true;}return false;}"></td>
  </tr>
</table></div>
</form>
<%response.write"<div class=pagestr>"&pagestr&"</div>"
%>
<%
case"delbbsgg"
dim delidsql,delbidsql

delbbsid=replace(","&request.form("delbbsid"),"'","")
delbbsid=split(delbbsid,",")

baction=replace(request.form("action"),"'","")

'============================================================================================
if baction=" 删除所选 " then

''''''''''''''''''''''''''''''''''''''''''''''''''''''''
if topictype=1 or topictype="" then
for i=1 to ubound(delbbsid)-1
delidsql=delidsql&"id="&delbbsid(i)&" or "
delbidsql=delbidsql&"bid="&delbbsid(i)&" or "
next
delidsql=delidsql&"id="&delbbsid(ubound(delbbsid))
delbidsql=delbidsql&"bid="&delbbsid(ubound(delbbsid))
if delidsql="id=" then delidsql="id=-1"
if delbidsql="bid=" then delbidsql="bid=-1"

sql1="delete*from topic where type=3 and bd="&bd&" and ("&delidsql&")"
sql2="delete*from bbs"&totable&" where (type=3 and bd="&bd&" and ("&delidsql&")) or ("&delbidsql&")"
conn.execute(sql1)
conn.execute(sql2)
end if
'''''''''''''''''''''''''''''''''''''''''''''''

'''''''''''''''''''''''''''''''''''
if topictype=2 then
for i=1 to ubound(delbbsid)-1
delidsql=delidsql&"bbsid="&delbbsid(i)&" or "
next
delidsql=delidsql&"bbsid="&delbbsid(ubound(delbbsid))
if delidsql="bbsid=" then delidsql="bbsid=-1"

sql1="delete*from bbs"&totable&" where type=3 and bd="&bd&" and ("&delidsql&")"
conn.execute(sql1)
end if
''''''''''''''''''''''''''''''''''''
response.redirect "adminbd2.asp?bd="&bd&"&totable="&totable&"&action=recycle&topictype="&topictype&""
end if
'=================================================================================================

'=================================================================================================

if baction=" 还原所选 " then
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
if topictype=1 or topictype="" then
for i=1 to ubound(delbbsid)-1
delidsql=delidsql&"id="&delbbsid(i)&" or "
next
delidsql=delidsql&"id="&delbbsid(ubound(delbbsid))
if delidsql="id=" then delidsql="id=-1"

sql1="update topic set type=0 where bd="&bd&" and ("&delidsql&")"
sql2="update bbs"&totable&" set type=0 where bd="&bd&" and ("&delidsql&")"
conn.execute(sql1)
conn.execute(sql2)
end if
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
if topictype=2 then
for i=1 to ubound(delbbsid)-1
delidsql=delidsql&"bbsid="&delbbsid(i)&" or "
next
delidsql=delidsql&"bbsid="&delbbsid(ubound(delbbsid))
if delidsql="bbsid=" then delidsql="bbsid=-1"
sql1="update bbs"&totable&" set type=0 where bd="&bd&" and ("&delidsql&")"
conn.execute(sql1)
end if
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
response.redirect "adminbd2.asp?bd="&bd&"&totable="&totable&"&action=recycle&topictype="&topictype&""

end if
'=================================================================================================
%>
<%end select

call down%>